﻿<!--文档查询条件选择-->
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=7" />
    <title>文档查询条件</title>
    @Html.Partial("LoadPanelPartial")
    @if (false)
    {
        <script src="../../../../Scripts/jquery-vsdoc.js" type="text/javascript"></script>
        <script src="../../../../Scripts/ASPxScriptIntelliSense.js" type="text/javascript"></script>
        <script src="../../../../Scripts/json2.js" type="text/javascript"></script>  
    }
    <link href="@Url.Content("~/Content/Site.css", true)" rel="stylesheet" type="text/css" />

    <script src="@Url.Content("~/Scripts/jquery.min.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Scripts/json2.js", true)" type="text/javascript"></script>

    <script src="@Url.Content("~/Common/GetRootPath.ashx", true)" type="text/javascript"></script>

    @Html.DevExpress().GetStyleSheets(

    new StyleSheet { ExtensionType = ExtensionType.ListBox, Theme = DevExpressHelper.Theme }
    )
    @Html.DevExpress().GetScripts(
        new Script { ExtensionType = ExtensionType.ListBox }
    )
    <style>
        .ctlDateEdit
        {
            position: relative;
            top: 0px;
            overflow: auto;
        }
    </style>

    <script type="text/javascript">
        var conditionModel = null; //信息查询条件实体类
        $(function () {
            conditionModel = parent.getQueryCondition();
            var clientFTitleObj = ASPxClientTextBox.Cast("FTitle");
            var clientBeginPubDateObj = ASPxClientDateEdit.Cast("BeginPubDate");
            var clientEndPubDateObj = ASPxClientDateEdit.Cast("EndPubDate");
            var clientrdFStatusObj = ASPxClientRadioButtonList.Cast("rdFStatus");
            var clientrdFIsEnrollObj = ASPxClientRadioButtonList.Cast("rdFIsEnroll");
            if (conditionModel != null && typeof (clientBeginPubDateObj) != "undefined"
            && typeof (clientEndPubDateObj) != "undefined" && typeof (clientrdFStatusObj) != "undefined") {
                clientFTitleObj.SetText(conditionModel.FTitle);
                clientBeginPubDateObj.SetText(conditionModel.BeginPubDate);
                clientEndPubDateObj.SetText(conditionModel.EndPubDate);
                if (conditionModel.FStatus == null) {
                    clientrdFStatusObj.SetValue("");
                }
                else {
                    clientrdFStatusObj.SetValue(conditionModel.FStatus);

                }
                clientrdFIsEnrollObj.SetValue(conditionModel.FIsEnroll);
                addUser();
                addDept();
                addWorkGroup();
            }
        });
        function ok() {
            var clientFTitleObj = ASPxClientTextBox.Cast("FTitle");
            var clientBeginPubDateObj = ASPxClientDateEdit.Cast("BeginPubDate");
            var clientEndPubDateObj = ASPxClientDateEdit.Cast("EndPubDate");
            var clientrdFStatusObj = ASPxClientComboBox.Cast("rdFStatus");
            var clientrdFIsEnrollObj = ASPxClientRadioButtonList.Cast("rdFIsEnroll");
            if (conditionModel != null) {
                conditionModel.FTitle = $.trim(clientFTitleObj.GetText());
                conditionModel.BeginPubDate = clientBeginPubDateObj.GetValue();
                conditionModel.EndPubDate = clientEndPubDateObj.GetValue();
                conditionModel.FStatus = clientrdFStatusObj.GetValue();
                conditionModel.FIsEnroll = clientrdFIsEnrollObj.GetValue();
            }
            parent.setQueryCondition(conditionModel);
        }
        /*发布单位改变*/
        function rdPubChoose_ValueChanged(s, e) {
            var clientrdPubChooseObj = ASPxClientRadioButtonList.Cast(s);
            var clienttxtDeptObj = ASPxClientButtonEdit.Cast("txtDept");
            var clientxtWorkGroupObj = ASPxClientButtonEdit.Cast("txtWorkGroup");
            if (clientrdPubChooseObj.GetValue() == "0") {
                //部门
                clienttxtDeptObj.SetVisible(true);
                clientxtWorkGroupObj.SetText("");
                clientxtWorkGroupObj.SetVisible(false);
                if (conditionModel != null) {
                    conditionModel.WorkGroupList = null;
                }
            }
            else {
                //工作组
                clientxtWorkGroupObj.SetVisible(true);
                clienttxtDeptObj.SetText("");
                clienttxtDeptObj.SetVisible(false);
                if (conditionModel != null) {
                    conditionModel.DeptList = null;
                }
            }
        }
        /*审核状态改变*/
        function rdFStatus_ValueChanged(s, e) {
            var clientrdFStatusObj = ASPxClientRadioButtonList.Cast(s);
            var clientrdFIsEnrollObj = ASPxClientRadioButtonList.Cast("rdFIsEnroll");
            if (clientrdFStatusObj.GetValue() == "Y") {
                clientrdFIsEnrollObj.SetEnabled(true);
                clientrdFIsEnrollObj.SetValue("");
            }
            else {
                clientrdFIsEnrollObj.SetEnabled(false);
                clientrdFIsEnrollObj.SetValue("");

            }
        }
        /*选择工作组*/
        function chooseWorkGroup() {
            var obj = new Object();
            var treeModelList = conditionModel.WorkGroupList;
            if (treeModelList == null) {
                obj.Value = "";
            }
            else {
                obj.Value = JSON.stringify(treeModelList);
            }
            var returnValue = window.showModalDialog(rootPath + "/Admin/Dialog/DocQueryWorkGroupChooseTree", obj, "dialogWidth=300px;dialogHeight=500px");
            if (typeof (returnValue) != "undefined") {
                var treeModelList = JSON.parse(returnValue);
                conditionModel.WorkGroupList = treeModelList;
                addWorkGroup();
            }

        }
        /*增加工作组*/
        function addWorkGroup() {
            if (conditionModel.WorkGroupList) {
                var treeModelList = conditionModel.WorkGroupList;
                var clienttxtWorkGroupObj = ASPxClientButtonEdit.Cast("txtWorkGroup");
                var workGroupString = "";
                for (var i = 0; i < treeModelList.length; i++) {
                    workGroupString += treeModelList[i].Text + ",";
                }
                workGroupString = workGroupString.substr(0, workGroupString.lastIndexOf(','));
                clienttxtWorkGroupObj.SetValue(workGroupString);
            }
        }
        /*选择部门*/
        function chooseDept() {
            var obj = new Object();
            var treeModelList = conditionModel.DeptList;
            if (treeModelList == null) {
                obj.Value = "";
            }
            else {
                obj.Value = JSON.stringify(treeModelList);
            }
            var returnValue = window.showModalDialog(rootPath + "/Admin/Dialog/DocQueryDeptChooseTree", obj, "dialogWidth=300px;dialogHeight=500px");
            if (typeof (returnValue) != "undefined") {
                var treeModelList = JSON.parse(returnValue);
                conditionModel.DeptList = treeModelList;
                addDept();
            }

        }
        /*部门增加*/
        function addDept() {
            if (conditionModel.DeptList) {
                var treeModelList = conditionModel.DeptList;
                var clienttxtDeptObj = ASPxClientButtonEdit.Cast("txtDept");
                var deptString = "";
                for (var i = 0; i < treeModelList.length; i++) {
                    deptString += treeModelList[i].Text + ",";
                }
                deptString = deptString.substr(0, deptString.lastIndexOf(','));
                clienttxtDeptObj.SetValue(deptString);
            }
        }
        /*选择发布人*/
        function chooseUser() {
            var obj = new Object();
            var treeModelList = conditionModel.PubEmplList;
            if (treeModelList == null) {
                obj.Value = "";
            }
            else {
                obj.Value = JSON.stringify(treeModelList);
            }
            var returnValue = window.showModalDialog(rootPath + "/Admin/Dialog/DocQueryEmpChooseTree", obj, "dialogWidth=300px;dialogHeight=500px");
            if (typeof (returnValue) != "undefined") {
                //$("#hdSelUserKeys").val(returnValue);
                var treeModelList = JSON.parse(returnValue);
                conditionModel.PubEmplList = treeModelList;
                addUser();
            }

        }
        /*用户增加*/
        function addUser() {
            if (conditionModel.PubEmplList) {
                var treeModelList = conditionModel.PubEmplList;
                var clienttxtUserObj = ASPxClientButtonEdit.Cast("txtUser");
                var userString = "";
                for (var i = 0; i < treeModelList.length; i++) {
                    userString += treeModelList[i].Text + ",";
                }
                userString = userString.substr(0, userString.lastIndexOf(','));
                clienttxtUserObj.SetValue(userString);
            }
        }
    </script>

</head>
<body>
    <table align="center" class="tableForm">
        <tr>
            <th style="width: 15%">
                @Html.DevExpress().Label(settings => { settings.Text = "信息标题:"; }).GetHtml()
            </th>
            <td style="width: 85%" class="tdClass">
                @Html.DevExpress().TextBox(settings =>
               {
                   settings.Name = "FTitle";
                   settings.Width = 380;
                   //settings.Text = Model.DocumentModel.FTitle;
               }).GetHtml()
            </td>
        </tr>
        <tr>
            <th style="width: 15%">
                @Html.DevExpress().Label(settings => { settings.Text = "发布时间:"; }).GetHtml()
            </th>
            <td style="width: 85%" class="tdClass">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            @Html.DevExpress().DateEdit(settings =>
            {
                settings.Name = "BeginPubDate";
                settings.Properties.NullText = "";
                settings.Properties.DisplayFormatString = "yyyy-MM-dd";
                settings.Properties.EditFormatString = "yyyy-MM-dd";
                settings.Properties.CalendarProperties.Style.CssClass = "ctlDateEdit";
                settings.Properties.CalendarProperties.ShowWeekNumbers = false;
               
            }).GetHtml()
                        </td>
                        <td>
                            &nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp; </td>
                        <td>
                            @Html.DevExpress().DateEdit(settings =>
            {
                settings.Name = "EndPubDate";
                settings.Properties.NullText = "";
                settings.Properties.DisplayFormatString = "yyyy-MM-dd hh:mm";
                settings.Properties.EditFormatString = "yyyy-MM-dd hh:mm";
                settings.Properties.CalendarProperties.Style.CssClass = "ctlDateEdit";
                settings.Properties.CalendarProperties.ShowWeekNumbers = false;
                //settings.Properties.EditFormat = EditFormat.Time;
                settings.Properties.EditFormat = EditFormat.Custom;
                //settings.Properties.EditFormatString = "MMMM dd, yyyy";
                //settings.Properties.DisplayFormatString = "MMMM dd, yyyy";
            }).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <th style="width: 15%">
                @Html.DevExpress().Label(settings => { settings.Text = "发布单位:"; }).GetHtml()
            </th>
            <td style="width: 85%" class="tdClass">
                @Html.DevExpress().RadioButtonList(settings =>
               {
                   settings.Name = "rdPubChoose";
                   settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
                   settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                   settings.Properties.Style.Border.BorderWidth = 0;
                   settings.Properties.RepeatColumns = 4;
                   settings.Properties.ClientSideEvents.Init = "function(s,e){rdPubChoose_ValueChanged(s,e)}";
                   settings.Properties.ClientSideEvents.ValueChanged = "function(s,e){rdPubChoose_ValueChanged(s,e)}";
               }).BindList(new List<SelectListItem>(){new SelectListItem(){ Value="0", Text="部门"},
                             new SelectListItem(){ Value="1", Text="工作组"} 
                                }).Bind("0").GetHtml()
            </td>
        </tr>
        <tr>
            <th style="width: 15%">
            </th>
            <td style="width: 85%" class="tdClass">
                <table cellpadding="0" cellspacing="0">
                    <tr>
                        <td>
                            @Html.DevExpress().ButtonEdit(settings =>
       {
           settings.Name = "txtDept";
           settings.Width = 380;
           settings.ReadOnly = true;
           settings.Properties.Buttons.Add("选择");
           settings.Properties.ClientSideEvents.ButtonClick = "function(s,e){chooseDept(s,e)}";
       }).GetHtml()
                        </td>
                        <td>
                            @Html.DevExpress().ButtonEdit(settings =>
                                  {
                                      settings.Name = "txtWorkGroup";
                                      settings.Width = 380;
                                      settings.ReadOnly = true;
                                      settings.Properties.Buttons.Add("选择");
                                      settings.Properties.ClientSideEvents.ButtonClick = "function(s,e){chooseWorkGroup()}";
                                  }).GetHtml()
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <th style="width: 15%">
                @Html.DevExpress().Label(settings => { settings.Text = "发布人:"; }).GetHtml()
            </th>
            <td style="width: 85%" class="tdClass">
                @Html.DevExpress().ButtonEdit(settings =>
                                  {
                                      settings.Name = "txtUser";
                                      settings.Width = 380;
                                      settings.ReadOnly = true;
                                      settings.Properties.Buttons.Add("选择");
                                      settings.Properties.ClientSideEvents.ButtonClick = "function(s,e){chooseUser()}";
                                  }).GetHtml()
            </td>
        </tr>
        <tr>
            <th style="width: 15%">
                @Html.DevExpress().Label(settings => { settings.Text = "审核状态:"; }).GetHtml()
            </th>
            <td style="width: 85%" class="tdClass">
                @Html.DevExpress().RadioButtonList(settings =>
               {
                   settings.Name = "rdFStatus";
                   settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
                   settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                   settings.Properties.Style.Border.BorderWidth = 0;
                   settings.Properties.RepeatColumns = 4;
                   settings.Properties.ClientSideEvents.Init = "function(s,e){rdFStatus_ValueChanged(s,e)}";
                   settings.Properties.ClientSideEvents.ValueChanged = "function(s,e){rdFStatus_ValueChanged(s,e)}";
               }).BindList(new List<SelectListItem>(){new SelectListItem(){ Value="", Text="全部"},
                            new SelectListItem(){ Value="N", Text="未审核"} ,
                             new SelectListItem(){ Value="Y", Text="已审核"} 
                                }).Bind("").GetHtml() </td>
            <tr>
                <th style="width: 15%">
                    @Html.DevExpress().Label(settings => { settings.Text = "录用状态:"; }).GetHtml()
                </th>
                <td style="width: 85%" class="tdClass">
                    @Html.DevExpress().RadioButtonList(settings =>
               {
                   settings.Name = "rdFIsEnroll";
                   settings.Properties.RepeatLayout = System.Web.UI.WebControls.RepeatLayout.Flow;
                   settings.Properties.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                   settings.Properties.Style.Border.BorderWidth = 0;
                   settings.Properties.RepeatColumns = 4;
               }).BindList(new List<SelectListItem>(){new SelectListItem(){ Value="", Text="全部"},
                            new SelectListItem(){ Value="Y", Text="录用"} ,
                             new SelectListItem(){ Value="N", Text="未录用"} ,
                              new SelectListItem(){ Value="U", Text="修改"} 
                                }).Bind("").GetHtml() </td>
            </tr>
    @Html.Hidden("hdSelUserKeys", "")@*选择发布人*@
</body>
</html>
